package com.x.mvp.widget.ruler;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;

/**
 * Created by H on 18/3/5.
 */

public class RulerView extends View {
    int foregoundColor = Color.BLUE;
    int backgoundColor = Color.BLACK;

    Rander rander;
    Rander labalRander;
    Rander triRander;

    public RulerView(Context context) {
        super(context);
        init();
    }

    public RulerView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public RulerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    void init() {
        rander = new ScaleRander(foregoundColor, backgoundColor, 5, 1000, 0);
        labalRander =  new LabelRander(foregoundColor, backgoundColor, 5, 1000, 0);
        triRander = new TrigleRander(foregoundColor, backgoundColor, 5, 1000, 0);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        rander.onDraw(canvas);
        labalRander.onDraw(canvas);
        triRander.onDraw(canvas);
    }
}
